#!ipxe

# Alpine Linux
# https://alpinelinux.org

isset ${dhcp-server} && set ipparam ip=dhcp || set ipparam ip=${ip}::${gateway}:${netmask}::eth0:none:${dns}

goto ${menu}

:alpinelinux
clear alpine_version
set os {{ releases.alpinelinux.name }}
iseq ${arch} x86_64 && set bootarch x86_64 || set bootarch x86
menu ${os} [${bootarch}]
item --gap Releases
{% for item in releases.alpinelinux.versions %}
item {{ item.code_name }} ${space} ${os} {{ item.name }}
{% endfor %}
choose alpine_version || goto alpine_exit
goto boot

:boot
set base-url ${alpinelinux_mirror}
set dir ${alpinelinux_base_dir}/${alpine_version}/releases/${bootarch}/netboot
set repo-url ${alpinelinux_mirror}/${alpinelinux_base_dir}/${alpine_version}/main
imgfree
kernel ${base-url}/${dir}/vmlinuz-lts ${ipparam} alpine_repo=${repo-url} modules=loop,squashfs modloop=${base-url}/${dir}/modloop-lts quiet nomodeset ${cmdline}
initrd ${base-url}/${dir}/initramfs-lts
echo
echo MD5sums:
md5sum vmlinuz-lts initramfs-lts
boot

:alpine_exit
clear menu
exit 0
